export const baseURL = "http://localhost:3000"
export const request = ({
    url,
    method,
    data,
    header,
}) => {
    return new Promise((resolve, reject) => {
        wx.showLoading({
            title: '请求中',
        })
        wx.request({
            url: url.indexOf('http') > -1 ?
                url : baseURL + url,
            method: method || 'get',
            data,
            header,
            success: res => {
                resolve(res)
            },
            fail(err) {
                reject(err)
            },
            complete() {
                wx.hideLoading()
            }
        })
    })
}